package com.zatech.cgnci.project.controller;


import com.zatech.cgnci.project.service.CgnciUnderwritingPolicyService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 超净自留处理方式 前端控制器
 * </p>
 *
 * @author Generator
 * @since 2024-12-18
 */
@RestController
@RequestMapping("/api/underwriting-policy")
@Api(produces = "application/json", tags = "超净自留处理方式api接口文档")
@RequiredArgsConstructor
public class CgnciUnderwritingPolicyController {

    private final CgnciUnderwritingPolicyService underwritingPolicyService;

    @GetMapping("/deleteById")
    @Transactional(rollbackFor = Exception.class)
    @ApiOperation(value = "变更险种的再保分出安排")
    public void deleteById(@RequestParam(value = "policyId") @ApiParam(value = "policyId") Long policyId,
                           @RequestParam(value = "reinsuranceArrangement") @ApiParam(value = "再保分出安排(1-临分分出,2-合约分出,3-预约临分分出),码表值:reinsuranceArrangement") String reinsuranceArrangement) {
        underwritingPolicyService.deleteUnderwritingPolicy(policyId, reinsuranceArrangement);
    }

    @GetMapping("/deletePolicy")
    @Transactional(rollbackFor = Exception.class)
    @ApiOperation(value = "变更年度承保政策")
    public void deletePolicy(@RequestParam(value = "id") @ApiParam(value = "项目-对应projectId,保单/分入/分出-对应insuranceId") Long id) {
        underwritingPolicyService.deletePolicy(id);
    }

}

